//
//  MainViewModel.swift
//  GomroStore
//
//  Created by mac on 2020/11/20.
//

import UIKit
import Foundation


/// MainViewModel
class MainViewModel: BaseViewModel {

    //MARK: - lazy load
    lazy var dicSearch:[String:Any]? = {
         //https://test-api-v2.gomro.cn/swagger-ui.html#/order-v-2-controller/customerGoodsPageUsingGET
        return nil
    }()
    
    /** 更新 */
    lazy var refreshUI:RACSubject = {
        let _rac = RACSubject.init()
        
        return _rac
    }()
    
    /** 结束动画 */
    lazy var stoploadingAnimation:RACSubject = {
        let _rac = RACSubject.init()
        
        return _rac
    }()
    
    /** 刷新、加载更多 */
    lazy var loadDataCommand:RACCommand = {
        let _com = RACCommand.init {[weak self] (input:Any?) -> RACSignal? in
            guard let self = self else { return nil }
            
            let signal:RACSignal = RACSignal.createSignal {[weak self] (subscriber:RACSubscriber?) -> RACDisposable? in
                guard let self = self else { return nil }
                guard let (_isLoadMore,_isLoading) = input as? (Bool,Bool) else { return nil }
                
                ///......
                return nil
            }
            
            return signal
        }
        
        return _com!
    }()
}
